package cn.edu.seu.cose.qol.ws.resource.util.adapter;

import cn.edu.seu.cose.qol.model.dto.admin.AdminInstance;
import cn.edu.seu.cose.qol.model.po.account.AdminAccount;

public class AdminAdapter {
	
	private static AdminAdapter _instance;
	
	public static AdminAdapter getInstance() {
		if (_instance == null) {
			_instance = new AdminAdapter();
		}
		
		return _instance;
	}
	
	protected AdminAdapter() {}
	
	public AdminInstance adapt(AdminAccount adminAccount) {
		String username = adminAccount.getUsername();
		String password = adminAccount.getPassword();
		
		AdminInstance adminInstance = new AdminInstance();
		adminInstance.setUsername(username);
		adminInstance.setPassword(password);
		
		return adminInstance;
	}
	
	public AdminAccount adapt(AdminInstance adminInstance) {
		String username = adminInstance.getUsername();
		String password = adminInstance.getPassword();
		
		AdminAccount adminAccount = new AdminAccount();
		adminAccount.setUsername(username);
		adminAccount.setPassword(password);
		
		return adminAccount;
	}

}
